from dajaxice.core import dajaxice_autodiscover, dajaxice_config
from django.conf import settings
from django.conf.urls.defaults import patterns, include, url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.views.generic import RedirectView
from django.views.generic.simple import direct_to_template
from index import index
from longerusernameandemail.forms import AuthenticationForm

#for django-cms ###
#for django-cms ###

# Uncomment the next two lines to enable the admin:
admin.autodiscover()

### for dajaxice ###########################
dajaxice_autodiscover()
### for dajaxice ###########################

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'mydjango.views.home', name='home'),
    # url(r'^mydjango/', include('mydjango.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
                       
    url(r'^$', RedirectView.as_view(url='/home/')),
#	url(r'^home/', include('users.urls')),
    url(r'^home/', index ), 
    url(r'^user/', include('users.urls')),
    url(r'^events/', include('events.urls')),
    url(r'^about/$', direct_to_template, {'template': 'template_AboutUs.html',}),
    url(r'^legal/', include('legal.urls')),
    
    url(r'^account/', include('django.contrib.auth.urls')),
    
    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),
    
    ### for google site management tool ###########################
    url(r'^google23361d773f7eebfa',
        'django.views.generic.simple.direct_to_template', {'template':'google23361d773f7eebfa.html'} ),
    
    ### for logner username and email ########################
    url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'authentication_form': AuthenticationForm}),
    ### for logner username and email ########################
    
    ### for dajaxice #########################################################
    url(dajaxice_config.dajaxice_url, include('dajaxice.urls')),
    
    
    # must be at the end of urls
    ### for django-cms #########################################################
    url(r'^', include('cms.urls')),
)

### for static files development enviroment ##############################
if settings.DEBUG:
    urlpatterns += patterns('',
                             url(r'^static/(?P<path>.*)$', 'django.views.static.serve',
                                 {'document_root': 'staticdev'}),
                            )
### for static files development enviroment ##############################


### for django-cms #########################################################
if settings.DEBUG:
    urlpatterns = patterns('',
    url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
    url(r'', include('django.contrib.staticfiles.urls')),
) + urlpatterns
### for django-cms #########################################################

### for dajaxice #########################################################
urlpatterns += staticfiles_urlpatterns()
### for dajaxice #########################################################
